// 截取参数
async function getParams(params, href) {
  let value = {};
  for (let i = 0; i < params.length; i++) {
    value[params[i]] = await interceptParams(params[i], href);
  }
  return new Promise((resolve) => {
    resolve(value);
  })
}

function interceptParams(params, href) {
  let value = decodeURIComponent(
    (new RegExp('[?|&]' + params + '=' + '([^&;]+?)(&|#|;|$)').exec(
      href || location.href
    ) || [, ''])[1]
    .replace(/\+/g, '%20')
  ) || '';

  return new Promise((resolve) => {
    resolve(value);
  })

}



export {
  getParams
}
